_init: function(name, size) {
this.actor = new St.Bin({ visible: false });
this.actor.connect('destroy', Lang.bind(this, this._onDestroy));
- this.actor.connect('notify::visible', Lang.bind(this, this._onVisibleNotify));
this._timeoutId = 0;
this._frame = 0;
this._animations = St.TextureCache.get_default().load_sliced_image (global.datadir + '/theme/' + name, size, size);
this.actor.set_child(this._animations);
+
+ this._update();
+ },
+
+ start: function() {
+ if (this._timeoutId == 0)
+ this._timeoutId = Mainloop.timeout_add(ANIMATED_ICON_UPDATE_TIMEOUT, Lang.bind(this, this._update));
},
- _disconnectTimeout: function() {
+ stop: function() {
if (this._timeoutId > 0) {
Mainloop.source_remove(this._timeoutId);
this._timeoutId = 0;
}
},
- _onVisibleNotify: function() {
- if (this.actor.visible)
- this._timeoutId = Mainloop.timeout_add(ANIMATED_ICON_UPDATE_TIMEOUT, Lang.bind(this, this._update));
- else
- this._disconnectTimeout();
- },
-
_showFrame: function(frame) {
let oldFrameActor = this._animations.get_child_at_index(this._frame);
if (oldFrameActor)
},
_onDestroy: function() {
- this._disconnectTimeout();
+ this.stop();
}
});
transition: "easeOutQuad",
onCompleteScope: this,
onComplete: function() {
+ this._spinner.stop();
this._spinner.actor.opacity = 255;
this._spinner.actor.hide();
}
startAnimation: function() {
this._stop = false;
this.actor.reactive = false;
+ this._spinner.start();
this._spinner.actor.show();
},